package com.itheima.service.db.imp;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.domain.db.Announcement;
import com.itheima.mapper.AnnouncementMapper;
import com.itheima.service.db.AnnouncementService;
import com.itheima.vo.PageBeanVo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class AnnouncementServiceImp implements AnnouncementService {
    @Autowired
    private AnnouncementMapper announcementMapper;
    @Override//查询公告分页
    public PageBeanVo findAnnouncement(Integer pageNum, Integer pageSize) {
        //创建分页条件
        Page page=new Page(pageNum,pageSize);
        //根据分页条件查询出分页类
        page=announcementMapper.selectPage(page,null);
        //返回结果
        return new PageBeanVo(pageNum,pageSize,page.getTotal(),page.getRecords());
    }
}
